package com.bestv.search.engine.xfire;

import com.bestv.search.common.model.AccessLog;
import com.bestv.search.common.model.History;
import com.bestv.search.common.model.SearchKeywordWrapper;
import org.apache.lucene.queryParser.ParseException;
import org.json.JSONException;

import java.util.Date;
import java.util.List;

//$Id: ISearchWS.java 124 2012-11-28 08:43:53Z luo.xiaojun $
public interface ISearchWS {

    String searchInType(String ptype, String keywords, String must, int start, int limit) throws ParseException;

    String searchOutType(String ptype, String keywords, String must, int start, int limit) throws ParseException;

    String searchPreview(String json) throws JSONException;

    String searchInOneFieldAndPtypeByOneKeyword(String ptype, String field, String keyword, int start, int limit);

    String searchByDoc(byte[] xmlDoc, String cmd);

    List<SearchKeywordWrapper> hitKeywordSync();

    void clearEngineKeyword();

    void hitLock();

    void hitFree();

    List<History> historySync();

    void clearEngineHistory();

    void historyLock();

    void historyFree();

    List<AccessLog> accessLogSync(String siteCode, int serverNo, Date lastAnalyzeDate, int maxAnalyzeDays,
                                  String logsFolder);

    String getTopNINfosToJSON(String type, boolean increase, int mergeType, int limit, String[] categorys)
            throws JSONException;

    List<List<String>> topnToList(String type, boolean increase, int mergeType, int limit, String[] categorys);

    void updateTopNCacheInMemory();

    String getPersonByDoc(String personId, String avatarRoot, int productFlag);
}
